Release 10.1A: OpenEdge Development:
Progress Dynamics Basic Development
Running business logic procedures in Progress Dynamics
As Progress Dynamics supports a stateless environment, you must write business logic as concisely and as efficiently as possible. When your environment uses one or more AppServers, which is considered the norm, a call to a business logic procedure will ordinarily result in a connect to an AppServer session (activation), the running of the code, and then the disconnection from the AppServer session (deactivation).
If you run a procedure persistently on the AppServer, then you will bind the connection to the AppServer until you delete the persistent procedure. You must take extreme care not to bind AppServer connections unnecessarily, as doing so negates the scalability of Progress Dynamics applications.
While you should keep persistent procedures to a minimum, when you use them, you should use the standard Progress Dynamics mechanism for invoking business logic procedures on an AppServer. This is supported by the Progress Dynamics Session Manager, in order that business logic procedures can be initiated on the AppServer and then accessed from client application sessions in the most efficient way possible.
These Progress Dynamics business logic procedures are called Persistent Libraries of Internal Procedures (PLIPs). They are external procedures (
.pfiles) that contain many internal procedures, run persistently (by a call tolaunchProcedure, normally handled by the Session Manager). The internal procedures usually relate to API calls relevant to a particular object. For example, a PLIP could be defined for various supporting logic for client updates. The internal procedures inside that PLIP could be called to validate particular parts of the client information or execute additional business logic, for example, when address information is changed.If business logic must identify whether it is running locally or remotely, then you can check the
session:remoteflag and SESSION:PARAM = “REMOTE”. If either of these is true, then the code runs remotely (on an AppServer), otherwise it runs locally on the client. You must also check the session parameter, since when running in a WebSpeed environment, thesession:remoteflag returns as false.All business logic in Progress Dynamics that must be run persistently must be run by a standard include file, called
launch.i, that encapsulates calls tolaunchProcedure. This include file takes one or more of the named arguments listed in Table 11–1.
The following rules apply to the use of
launch.i:
- Required logical arguments must be passed in unquoted as
YESorNO. Other text arguments must be single quoted literals (for example, 'text') or unquoted variables. If the literals require spaces, they should be double quoted then single quoted (for example, '"text text"').- The only exception to the above rule is for the parameter list, which does not support a variable, so only double quotes must be used.
- You can omit the internal procedure so you can manually run procedures in the PLIP. The PLIP handle is made available in
hPlip, a standard Progress 4GL variable.- If the
&OnAppparameter is not specified, it defaults toYES, which means that the procedure runs on the AppServer, if one is connected; otherwise it runs locally. Passing inAPPSERVERcauses the procedure to fail if the AppServer is not connected.- If the
&OnAppparameter is not set toNO, then you can specify a partition that will be connected, if not already connected. If you do not specify a partition, it defaults to the standard AppServer partition and runs on thegshAppserverhandle.- If the &Perm parameter is passed in as
YES, then the procedure is not killed when the agent disconnects, leaving it running for other connections. This is not the norm.- If
&AutoKillis set toYES, then following the run of the internal procedure in the persistent procedure, the PLIP is automatically closed. This is useful when you are running routines on an AppServer to ensure the connection does not remain bound.- If
&NewInstanceis set toYES, then it does not check for an already running instance of the PLIP to use. Instead, it runs a new version.Following the use of the include file, the variable values noted in Table 11–2 will be defined and available.
Table 11–2: Variable values available Variable Definition Handle of the PLIP that was run. Error button chosen, if any.
If the run failed for any reason, the
hPliphandle will be invalid and any errors will have been displayed, if possible:
dynlaunch.i
This include file is only recommended for Appserver calls where the procedure handle is not need after the call. It encapsulates the dynamic call wrapper and, therefore, all dynamic call wrapper comments apply.
dynlaunch.iaccepts a temp-table of call information. The call is then constructed from this information and invoked. This process does result in a performance overhead. It is recommended that users only use this call under the following conditions:When making calls across the Appserver, the call is constructed and invoked from a non-persistent procedure on the Appserver. The call results are stored in the temp-table, and returned to the user. This results in one Appserver call, with the agent not bound. Note that persistent procedure handles are not available to the client after the call has completed. If the user wishes to run a procedure persistently and use the procedure handle after the call, it is recommended that
launch.ibe used.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |